import { useTable, LIST_TYPE } from '@crud/index';
import { getColonelOrderList } from '@/api/crm-agency/kgj/colonel-order';

// 查询

export const payOptions = [
  { label: '不限', value: -1 },
  { label: '会员代充', value: 1 },
  { label: '会员采购', value: 2 }
];
export const commissionStatusOptions = [
  { label: '不限', value: -1 },
  { label: '已结算', value: 1 },
  { label: '未结算', value: 0 },
  { label: '部分结算', value: 2 }
];
export const typeOptions = [
  { label: '不限', value: -1 },
  { label: '老客户', value: 1 },
  { label: '新客户', value: 2 }
];
/** 团队人数 */
export const teamCountOptions = [
  { label: '不限', value: -1 },
  { label: '1人', value: 1 },
  { label: '3人', value: 3 },
  { label: '5人', value: 5 },
  { label: '7人', value: 7 },
  { label: '10人', value: 10 },
  { label: '15人', value: 15 },
  { label: '20人', value: 20 }
];
export const treeDataOptions = [
  { value: '-1', label: '不限' },
  {
    value: '10',
    label: '轻享版',
    children: [
      { value: '10_2', label: '季卡' }
    ]
  },
  {
    value: '20',
    label: '旗舰版',
    children: [
      { value: '20_1', label: '月卡' },
      { value: '20_2', label: '季卡' },
      { value: '20_3', label: '年卡' }
    ]
  },
  {
    value: '30',
    label: '至尊版',
    children: [
      { value: '30_1', label: '月卡' },
      { value: '30_2', label: '季卡' },
      { value: '30_3', label: '年卡' }
    ]
  }
  /* {
    value: '1',
    label: '月卡会员',
    children: [
      { value: '1_-1', label: '不限' },
      { value: '1_1', label: '1人' },
      { value: '1_3', label: '3人' },
      { value: '1_5', label: '5人' },
      { value: '1_10', label: '10人' }
    ]
  },
  {
    value: '2',
    label: '季卡会员',
    children: [
      { value: '2_-1', label: '不限' },
      { value: '2_1', label: '1人' },
      { value: '2_3', label: '3人' },
      { value: '2_5', label: '5人' },
      { value: '2_10', label: '10人' }
    ]
  },
  {
    value: '3',
    label: '年卡会员',
    children: [
      { value: '3_-1', label: '不限' },
      { value: '3_1', label: '1人' },
      { value: '3_3', label: '3人' },
      { value: '3_5', label: '5人' },
      { value: '3_10', label: '10人' }
    ]
  },
  {
    value: '4',
    label: '扩充团队',
    children: [
      { value: '4_-1', label: '不限' },
      { value: '4_3', label: '3人' },
      { value: '4_5', label: '5人' },
      { value: '4_10', label: '10人' }
    ]
  } */
];

export const payTypeObj = { 1: '渠道支付', 2: '渠道key支付', 3: '赠送码兑换' };
export const isInvoiceObj = { 0: '未开票', 1: '未开票', 2: '已开票' };
export const statusObj = { 0: '未结算', 1: '已结算', 2: '部分结算' };
// 表格
export const useTableList = (options: any = {}) => {
  const columns: any = [
    { label: '订单ID', prop: 'trade_no', fixed: 'left', width: 280, tooltip: true },
    { label: '代理商昵称', prop: 'colonel_name', minWidth: 200 },
    { label: '代理手机号', prop: 'colonel_mobile', minWidth: 120 },
    { label: '客户昵称', prop: 'user_name', minWidth: 160 },
    { label: '客户手机号', prop: 'mobile', minWidth: 160 },
    { label: '客户类型', prop: 'is_new_order_str', minWidth: 120 },
    { label: '支付类型', prop: 'pay_type_str', minWidth: 120 },
    { label: '会员信息', prop: 'subject', minWidth: 120 },
    { label: '团队人数', prop: 'team_count', minWidth: 120 },
    { label: '支付金额', prop: 'total_fee', minWidth: 120 },
    { label: '佣金', prop: 'settle_fee', align: 'center', minWidth: 120, render: 'settle_fee' },
    { label: '销售时间', prop: 'add_time', type: 'dateTime', minWidth: 177, align: 'center' },
    { label: '备注', prop: 'remark', render: 'remark', minWidth: 200, fixed: 'right', align: 'center' }
  ];

  return useTable({
    ...options,
    type: LIST_TYPE.AGENCY,
    params: {
      colonel_id: -1,
      pay_type: -1,
      user_type: -1,
      product: -1,
      team_count: -1,
      commission_status: -1,
      keyword: undefined,
      from_dt: undefined,
      to_dt: undefined
    },
    columns: columns,
    getList: getColonelOrderList
  });
};
